﻿using AutoMapper;
using XinLife.Model;

namespace XinLife.Common.Setup
{
    public static class AutoMapperSetup
    {
        /// <summary>
        /// Automapper 启动服务
        /// </summary>
        public static void AddAutoMapperSetup(this IServiceCollection services)
        {
            AutoMapper.IConfigurationProvider config = new MapperConfiguration(cfg =>
            {
                cfg.AddProfile<ServiceMappingProfile>();
            });
            services.AddSingleton(config);
            services.AddTransient<IMapper, Mapper>();
        }
    }
}
